<%= stylesheet_link_tag 'ui.datepicker' %>
<%= javascript_include_tag 'ui.datepicker' %>
<%= javascript_include_tag 'ui.datepicker-zh-CN' %>
<%= javascript_include_tag 'mine' %>
<%= javascript_include_tag 'jquery.tools.min' %>
<%= javascript_include_tag 'overlay' %>

<%= render :partial =>'/store/toolbar'%>

<div id="content_container">
  <%  if @products && @products.size > 0  %>
    <h1> 我的设计</h1>
    <%= render :partial =>'/products/hot_list',:object=>@products%>
    <div id="pager">
      <%= will_paginate @products,:prev_label => '«上一页',:next_label => '下一页»' %>
    </div>
  <% end %>
  <div class="my_order">
    <h1>我的订单</h1>
    <p>&nbsp;</p>
    <table class="admin" style="width:800px;">
      <thead>
        <tr>
          <th>单号</th>
          <th>金额</th>
          <th>下单日期</th>
          <th>账号</th>
          <th>交易状态</th>
          <th>物流方式</th>
          <th>物流单号</th>
          <th></th>
          <% if merchandiser? %>
            <th></th>
          <%end%>
        </tr>
      </thead>
      <tfoot>
        <tr>
          <td colspan="8" style="text-align:right">
            <form action="" method="get" >
              下单日期: 开始 <input  type="text"  name="start_date" size="10" id='start_date' ></input>
              结束 <input  type="text"  name="end_date" size="10" id="end_date" ></input>

              订单状态:<%=select_tag(:status,options_for_select(Order::STATUS,params[:status]))%>
              <input   type="submit" value="筛选" ></input>
              <% if params[:status] && admin? %>
                <a href="/store/print?status=<%=params[:status]%>&start_date=<%=params[:start_date]%>&end_date=<%=params[:end_date]%>" class="action_print">打印结果</a>
              <% end %>
            </form>
          </td>
          <% if merchandiser? %>
            <td class="action_link"></td>
          <%end%>
        </tr>
      </tfoot>

      <tbody>
        <% if @orders.length > 0 %>
          <% for order in @orders %>
            <tr>
              <td><%=order.id%></td>
              <td><%=order.total_price%></td>
              <td><%=order.created_at.strftime("%y-%m-%d %I:%M%p")%></td>
              <td><%=order.user.login%></td>
              <td>
                <%=format_status order.status%>
                <% if order.status == 1 %>
                  <a href="/payments/new/<%=order.id%>">(支付)</a>
                <%end%>
              </td>
              <td>
                <%=order.logistic.name%>
                <a href="<%=order.logistic.query_url%>" target="_blank" >(查询)</a>
              </td>
              <td><%=order.logistics_order_no%></td>
              <td class="action_link"><a href="/orders/<%=order.id%>" class='action_print'>详细</a></td>
              <% if merchandiser? %>
                <td class="action_link"><%= link_to '删除', order, :confirm => '确定删除订单?', :method => :delete,:class=>'action_delete'%></td>
              <%end%>
            </tr>
          <% end %>
        <%else%>
          <tr>
            <td colspan="8" style="text-align:center">
              暂无订单
            </td>
            <% if merchandiser? %>
              <td></td>
            <%end%>
          </tr>
        <%end%>
      </tbody>

    </table>
    <div id="pager">
      <%= will_paginate @orders,:prev_label => '«上一页',:next_label => '下一页»' %>
    </div>
    <%if @domain %>
      <div  id="ad">
        <h1>广告管理</h1>
        <p>广告有两种方案，请选择适合自己的</p>
        <pre>
      <a href="#yhm">方案一：使用优惠码</a>    <a href="#dm">方案二：在网页放置代码</a>    <a href="/articles/5" target="_blank">加盟帮助</a>
        </pre>
        <h1><a name="yhm">一，使用优惠码</a></h1>
        <p>
          <label>宣传优惠码:</label>
          <%=@user.code%>
        </p>
        <p>适用于博客，论坛，个人站点等web2.0网站</p>
        <h1><a name="dm">二，在网页放置代码</a></h1>
        <p>广告图片共有120×60，250×60，468×60，728×90，950×90五种尺寸</p>
        <p>要在你的网站上显示TT小站的广告，请选择合适的尺寸，然后把相应代码插入你的网站模板</p>
        <ul>
          <% for @photo in @photos  %>
            <li>
              <% if @photo.url %>
                <%= image_tag url_for_file_column(@photo, "url"),:class=>'photo_img' %>
              <%  end %>
              <div>
                <%=@photo.remark%>
              </div>
              <span>
                &lt;script type="text/javascript" src="<%=@domain%>/users/<%=session[:user_id]%>/generate_code?photo_id=<%=@photo.id%>"&gt;&lt;/script&gt;
              </span>
            </li>
          <%end%>
        </ul>
      </div>
    <%end%>
  </div>
</div>

